﻿@{
    ViewBag.Title = "NatureEdit";
}
@using CRM.Admin.Areas.Customer.Controllers
@using CRM.Admin.Contracts.Dto.Sys
@model CRM.Admin.Contracts.Dto.Customer.NatureDto

@section head
{
    <script src="@Url.Content("~/ScriptPlugin/validate/validate.js")"></script>
    <link href="@Url.Content("~/ScriptPlugin/validate/validate.css")" rel="stylesheet" />
    <script type="text/javascript" src="@Url.Content("~/Scripts/form2json.js")"></script>
    <script type="text/javascript" src="@Url.Content("~/Scripts/jquery.validate.min.js")"></script>
    <script type="text/javascript" src="@Url.Content("~/Scripts/jquery.validate.extended.js")"></script>

}
<form action="" id="NatureEdit">
    <div class="content-form">
    <table class="content-table">
        <tr>
            <th><span>性质(值)</span></th>
            <td>
                <input type="text" data-validate-option="isNull" id="Value" name="Value" value="@Model.Value"/>
                <input type="hidden" id="Id" name="Id" value="@Model.Id"/>
            </td>
            <th>排序号</th>
            <td>
                <input type="text" style="ime-mode:Disabled" id="Order" value="@Model.Order" name="Order" onkeypress="KingsSharp.OnlyNum();"/>
            </td>
        </tr>
        <tr>
            <th><span>所属性质</span></th>
            <td>
                <input type="text" id="NatureCatalogName" data-validate-message="所属性质不能为空" data-validate-option="isNull" name="NatureCatalogName" class="p-icon-right p-icon-catalog" readonly="readonly" onclick="getParent()" value="@Model.NatureCatalogName"/>
                <input type="hidden" id="NatureCatalogId" name="NatureCatalogId" value="@Model.NatureCatalogId"/>
            </td>
            <th></th>
            <td></td>
        </tr>
        <tr>
            <th>性质说明</th>
            <td colspan="3">
                <input type="text" id="Description" name="Description" value="@Model.Description"/>
            </td>
        </tr>
        <tr>
            <td colspan="4" style="padding:1px 1px 0px 1px;vertical-align:top">
                <div class="remark">
                </div>
            </td>
        </tr>
    </table>f
    </div>
</form>
@section foot
{
    <script type="text/javascript">
    function getParent()
    {
        K.layer.iframe({
            title: "性质选择",
            initfull: false,
            content: "@Url.Content("~/Customer/Nature/NatureTypeTree")",
                area: ["360px", "335px"],
                callback: function (node) {
                    $("#NatureCatalogName").val(node.name);
                    $("#NatureCatalogId").val(node.id);
                }
            });
    }
    </script>
        <script type="text/javascript">
       function SaveData(index) {
           if ($("#NatureEdit").valid()) {
               var dto = $("#NatureEdit").serializeArray();
               K.AjaxJson("@Url.Content("~/Customer/Nature/NatureUpdate")", dto, function (result) {
                    parent.K.layer.callback(index, result, dto);
                    parent.K.layer.close(index);
                });
           }
       }
        </script>
    
}